package com.idemon.server.soap;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * ====================================================
 *
 * @author Created by idemon on 2016/1/26.
 * @version IdeaProject-1.0
 * @since JDK7.0+ ====================================================
 */
public class HelloServiceImpl implements IHelloService {
	@Override
	public String sayHello(Picture pic) {
		InputStream is = null;
		FileOutputStream fos = null;
		try {
			is = pic.getImage().getInputStream();
			fos = new FileOutputStream("D:/aa.jpg");
			byte[] buffer = new byte[1024];
			int length = 0;
			while ((length = is.read(buffer)) != -1) {
				fos.write(buffer, 0, length);
				fos.flush();
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				fos.close();
				is.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return "Hello";
	}
}
